class Bird:
    pass


class Duck(Bird):  # <1>
    def quack(self):
        print('Quack!')


def alert(birdie):  # <2>
    birdie.quack()


def alert_duck(birdie: Duck) -> None:  # <3>
    birdie.quack()


def alert_bird(birdie: Bird) -> None:  # <4>
    birdie.quack()  # 提示：Bird没有quark()


daffy = Duck()
alert(daffy)       # <1>
alert_duck(daffy)  # <2>
alert_bird(daffy)  # <3>
# 均可行：在运行时只看是否能调用quack()
